<%@page import="com.nebula.util.UsernameEncryptionUtil"%>
<%@page import="com.nebula.common.Const"%>
<%@page import="com.nebula.pojo.User"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<!DOCTYPE HTML>
<html>
<head>
<title>大岭山中学网盘 请输入提取密码</title>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/css/share-multi.css" />
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/css/page-ui.css" />
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/css/cover.css" />
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/css/header-theme.css" />	
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/h-ui.admin/css/H-ui.admin.css" />
<style type="text/css">
	body{
		background: #edf1f5;
	}
</style>
</head>
  
<body onload="getCookie()">
<input type="hidden" value="<%=request.getParameter("surl")%>" id="surl">
<input type="hidden" value="<%=request.getAttribute("type")%>" id="type">
<div class="docs init-docs">
	<div class="acss-header">
		<div class="acss_banner"></div>
		<div class="verify-form">
			<form action="" class="clearfix" name="accessForm" onsubmit="return false">
				<div class="CMxQsC">
					<div class="avatar">
						<div class="photo-frame">
							<span class="radius-3">
								<img class="nav-user-photo" style="border: 3px solid #3779d6;" src="${pageContext.request.contextPath}/static/avatars/user.jpg" alt="<%=request.getParameter("username")%>" width="44" />
							</span>
						</div>
					</div>
					<span class="verify-property" style="margin-left: 5px;"><strong><%=UsernameEncryptionUtil.encryptionUsername(request.getAttribute("username").toString())%></strong>给您加密分享了文件</span>
					<div class="cb"></div>
				</div>
				<div class="verify-input ac-close clearfix">
					<dl class="pickpw clearfix">
						<dt>请输入提取密码：</dt>
						<dd class="clearfix">
							<input class="QKKaIE LxgeIt" id="zawr7PqJ" tabindex="1" type="text">
							<div id="ububJv57">
								<a class="btn btn-primary radius" style="height: 37px;padding-top: 7px;margin-left: 14px;" href="javascript:;" title="提取文件">
									<span class="g-button-right">
										<span class="text" style="width: auto">提取文件</span>
									</span>
								</a>
							</div>
						</dd>
					</dl>
				</div>
			</form>
			<div id="apaVEnA" style="display: none;"></div>
		</div>
	</div>
</div>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/jquery.base64.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/jquery.cookie.js"></script>
<script type="text/javascript">
function getCookie(){
	var validate = $.cookie("validate");
	if(validate){
		if($.base64.decode(validate) == $("#surl").val()){
			window.location = "/nebula/share/share_list.action?surl="+$("#surl").val()
		}
	}
}
$("#zawr7PqJ").bind("keypress",function(event){
	if(event.keyCode == "13"){
		$(".text").click();
	}
})

$(function(){
	$(".text").click(function(){
		if($("#zawr7PqJ").val() == ""){
			$("#apaVEnA").html("请输入提取密码再提交");
			$("#apaVEnA").attr("style","display:block");
		}else{
			$.ajax({
				type: "post",
				url : "/nebula/share/checkKey.action",
				data: {
					key : $("#zawr7PqJ").val().trim(),
					surl : $("#surl").val().trim()
				},
				dataType:"json",
				success : function(data){
					if(data.status == 0){
						var date = new Date();
						date.setTime(date.getTime() + 1800 * 1000);
						$.cookie("validate",$.base64.encode($("#surl").val()),{expires: date,path:'/'});
						window.location = "/nebula/share/share_list.action?surl="+$("#surl").val()
					}else if(data.status == 1){
						$("#apaVEnA").html(data.msg);
						$("#apaVEnA").attr("style","display:block");
					}
				}
			});
		}
	})
});
</script>
</body>
</html>
